class Solution(object):
    def checkOnesSegment(self, s):
        state = 0
        for c in s[1:]:
            if c == '0':
                state = 1
            if c == '1':
                if state:
                    return False
        return True